// part1:C14:ex14.40.cpp
// biggies() function.
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
class IsShorter
{
public:
private:
    bool operator()(const std::string &s1, const std::string &s2)
    {
        return s1.size() < s2.size();
    }
};

class NotShorterThan
{
public:
    NotShorterThan(int len): minLen(len){}
    bool operator()(const std::string &str)
    {
        return str.size() >= minLen;
    }
private:
    int minLen;
};

class PrintString
{
public:
    void operator()(const std::string &str)
    {
      std::cout << str << " ";
    }
private:
};

void biggies(std::vector<std::string> &words, std::vector<std::string>::size_type sz)
{
    elimDups(words);
    IsShorter(is);
    stable_sort(words.begin(), words.end(), is);

    NotShorterThan nst(sz);
    auto wc = find_if(words.begin(), words.end(), nst);
    auto count = words.end() - wc;
    std::cout << count << " " << make_plural(count, "word", "s")
      << " of length " << sz << " or longer " << endl;

    PrintString ps;
    for_each(wc, words.end(), ps);
    std::cout << endl;
}
